% mrt functions
include("mrt.pro").

% need at least 5 test cases
% one menu can run 3 to 4 choices at a time only for now.
menu:- nl, 
	write('Select your Test Case 1. to 11. :'),nl,		
	write('Quit: select 0. then type quit.'),nl,nl,
	write('Enter choice: '),read(Choice),userInput(Choice).

%test case 1: start from multi stn, without transfer
userInput(Choice):- 
	nl,
	Choice = 1, 	
	find_distance("Tanah Merah", "Eunos", Path, Time), 	%Expected Time = 9
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.

%test case 2: passby a multi station, without transfer 
userInput(Choice):- 
	nl,
	Choice = 2, 	
	find_distance("Khatib", "Novena", Path, Time), 	%Expected Time = 15
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.

%test case 3: land at a multi staion, without transfer 
userInput(Choice):- 
	nl,
	Choice = 3, 	
	find_distance("Aljunied", "City Hall", Path, Time), 	%Expected Time = 11
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.

%test case 4: 1 end to another end, without transfer 
userInput(Choice):- 
	nl,
	Choice = 4, 	
	find_distance("Joo Koon", "Pasir Ris", Path, Time),	%Expected Time = 59
	%find_distance("Pasir Ris", "Joo Koon", Path, Time),	%Expected Time = 59
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.
	
%test case 5: normal, with 1 transfer
userInput(Choice):- 
	nl,
	Choice = 5, 
	find_distance("Joo Koon", "Choa Chu Kang", Path, Time),	%Expected Time = 24
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.

%test case 6: multi stn to multi stn, with 1 transfer
userInput(Choice):- 
	nl,
	Choice = 6, 
	find_distance("Bishan", "Outram Park", Path, Time), 	%Expected Time = 28
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.

%test case 7: passby 3 or 4 multi stn, with 1 transfer
userInput(Choice):- 
	nl,
	Choice = 7, 
	find_distance("Chinese Garden", "Orchard", Path, Time),	%Expected Time = 38
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.
	
%test case 8: normal, 2 transfer
userInput(Choice):- 
	nl,
	Choice = 8, 
	find_distance("Joo Koon", "Braddell", Path, Time),	%Expected Time = 43
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.

%test case 9: normal, 3 transfer
userInput(Choice):- 
	nl,
	Choice = 9, 
	find_distance("Kovan", "Changi Airport", Path, Time),	%Expected Time = 40
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.	

%test case 10: passby and end on multi station, without transfer
userInput(Choice):- 
	nl,
	Choice = 10, 
	find_distance("Marina Bay", "City Hall", Path, Time),	%Expected Time = 7
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.	

%test case 11: did not travel
userInput(Choice):- 
	nl,
	Choice = 11, 
	find_distance("Bugis", "Bugis", Path, Time),	%Expected Time = 0
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.	
	
%test case 99: own trying out test cases (previously algo-> stack full, current algo-> working)
userInput(Choice):- 
	nl,
	Choice = 99, 
	find_distance("Farrer Park", "Joo Koon", Path, Time),	%Expected Time = 44
	write('Path: '), write(Path), nl,
	write('Travelling Time: '), write(Time), nl,	
	menu.	

%quit program	
userInput(Choice):- Choice = 0, write('Exiting program...'),nl.

:- nl,nl,menu. %auto run programme.